<?php
error_reporting(E_ALL);

$path = '';
if ( key_exists('path', $_REQUEST))
{
	$path = $_REQUEST['path'];
}
//lettura file cartella
if ($handle = opendir('../../content/'.$path)) 
{
	
	$toJson = '';
	while (false !== ($entry = readdir($handle))) {
		
		if ($entry == "." || $entry == "..")
		{
			continue;
		}
		
		
		$obj->path = $entry;
		
		
		$toJson[] = $obj;
		unset($obj);
		
    }
    
    closedir($handle);    
    
    echo json_encode($toJson);
	
}